Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Windows.Forms

Public Class frmCrThongKe_ChiTiet_Nhap
    Private data As DataTable
    Private thang, nam As Date
    Private customerReport As ReportDocument

    Delegate Sub WaitDelegate()

    Private Sub frmCrThongKe_ChiTiet_Nhap_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        globalVariale.runWaitting = True
        Dim wd As New WaitDelegate(AddressOf moduleWaitting.runningWait)
        wd.BeginInvoke(Nothing, Nothing)
        Dim sqlQuery As String = ""
        sqlQuery = " SELECT t1.*,t3.ma_nhom_hanghoa as nhom,t3.ten_nhom_hanghoa as tennhom "
        sqlQuery += " FROM ( tbl_dot_chitiet_nhap_hms as t1 left join tbl_hanghoa as t2 on t1.ma_hanghoa=t2.ma_hanghoa ) "
        sqlQuery += " left join tbl_nhom_hanghoa as t3 on t2.ma_nhomhanghoa=t3.ma_nhom_hanghoa  "
        sqlQuery += " ORDER BY ten_bietduoc "
        Dim reportPath = Application.StartupPath & "\" & "crThongke_chitiet_nhap.rpt"
        customerReport = New ReportDocument()
        customerReport.Load(reportPath)
        customerReport.SetDataSource(moduleReportConfig.GetDataTable(sqlQuery))
        customerReport.SetParameterValue("month", thang)
        customerReport.SetParameterValue("year", nam)
        customerReport.SetParameterValue("company", globalVariale.COMPANY)
        customerReport.SetParameterValue("address", globalVariale.ADDRESS)
        Me.CrNXTTongHopview.ReportSource = customerReport

        globalVariale.runWaitting = False
    End Sub

    Private Sub BtnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Close()
    End Sub
    Public Sub setThang(ByVal s As Date)
        thang = s
    End Sub

    Public Sub setNam(ByVal s As Date)
        nam = s
    End Sub

    Public Sub setData(ByVal d As DataTable)
        data = d
    End Sub


End Class
